#include <stdio.h>

int atoi(char s[]){
	int i = 0, result = 0 ;
	char c;
	while(s[i] != '\0' && s[i] != '\n' && s[i] != EOF){
		if(s[i] >= '0' || s[i] <= '9'){
			result = result*10 + (s[i] - '0');
			i++;
		}else{
			return -1;
		}
	}	
	return result;
}

int main(){
	char s[] = "012";
	int result = 0;
	result = atoi(s);
	printf("%d\n", result);
	return 0;
}